/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package quan;

import java.util.Comparator;

/**
 *
 * @author Quannk
 */
public class QComparator implements Comparator<QInternalFrame> {

    @Override
    public int compare(QInternalFrame o1, QInternalFrame o2) {
        Integer a, b;
        if (o1.parentFrame != null) {
            a = o1.parentFrame.index;
        } else {
            a = o1.index;
        }
        if (o2.parentFrame != null) {
            b = o2.parentFrame.index;
        } else {
            b = o2.index;
        }
        return a.compareTo(b);
    }
}
